package demo1;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        String[] array = new String[]{"i","love","leetcode","i","love","coding"};
        SolutionOther solutionOther = new SolutionOther();
        List<String> ret = new ArrayList<>();
         ret = solutionOther.topKFrequent(array,3);
        for(String str : ret) {
            System.out.print(str+" ");
        }
    }
    public static void main1(String[] args) {
        Solution solution = new Solution();
        String[] array = new String[]{"hello","world","complex","world",
        "silicon","former","world","complex","hello"};
        // world 3  complex 2  hello 2
        List<String> ret = solution.topKFrequent(array,2);
        Iterator it = ret.iterator();
        while(it.hasNext()) {
            String str = it.next().toString();
            System.out.print(str+" ");
        }
    }
}
